package com.yequan.designpattern.singleton.EnumFactory;

/**
 * @Auther: yq
 * @Date: 2019/1/11 13:10
 * @Description:
 */
public class SEnumSingletonTest {

    public static void main(String[] args) {
        Thread thread1 = new Thread(new Runnable() {
            @Override
            public void run() {
                //EnumFactory.singletonFactory 暴露了枚举类
                System.out.println("thread1 >>>>> " + EnumSingleFactory.getInstance().hashCode());
            }
        });
        Thread thread2 = new Thread(new Runnable() {
            @Override
            public void run() {
                System.out.println("thread2 >>>>> " + EnumSingleFactory.getInstance().hashCode());
            }
        });
        Thread thread3 = new Thread(new Runnable() {
            @Override
            public void run() {
                System.out.println("thread3 >>>>> " + EnumSingleFactory.getInstance().hashCode());
            }
        });

        thread1.start();
        thread2.start();
        thread3.start();
    }

}
